package com.kk.xhr.model.service.impl;

import com.kk.xhr.model.dao.NationMapper;
import com.kk.xhr.model.entity.Nation;
import com.kk.xhr.model.service.INationService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 民族服务接口实现
 *
 * @author kkmystery
 * @version 1.0 2021/3/4
 * @since 1.0.0
 */
@Repository
@RequiredArgsConstructor
public class NationServiceImpl implements INationService {
    private final NationMapper nationMapper;

    @Override
    public List<Nation> query() {
        return nationMapper.select(dsl -> dsl);
    }

    @Override
    public String queryById(Long id) {
        return nationMapper.selectByPrimaryKey(id).map(Nation::getName).get();
    }
}
